﻿@model Projectmanagement.Models._Construct
<script type="text/javascript">
    var fileName = "";

    function UploadProfileImage_OnUpload(e) {
        var id = $("#ID").val();
        var files = e.files;
        $.each(files, function () {
            fileName = this.name + ',' + fileName;
        });
        $("#TravelFileId").val(fileName);
        e.data = { strImageName: fileName };
    }
    
   
</script>
<fieldset>
    <legend>搭建</legend>
    <table class="noline" style="line-height: 30px; border:1px solid #eee; margin-top:20px;">
        <tr style="line-height: 1px; background-color: #F1F1F1;">
            <td colspan="8">
                <p style="font-weight: bolder">
                    联系人</p>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr>
            <td align="right" style="width: 150px;">
                @Html.LabelFor(x => x.ComyanyName):
            </td>
            <td>
                @Html.TextBoxFor(x => x.ComyanyName, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.ComyanyName)
            </td>
            <td align="right">
                @Html.LabelFor(x => x.ConstructName):
            </td>
            <td>
                @Html.TextBoxFor(x => x.ConstructName, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.ConstructName)
            </td>
            <td align="right">@Html.LabelFor(x => x.ConstructWay):
            </td>
            <td>
                @Html.TextBoxFor(x => x.ConstructWay, new { style = "width:165px;" })<br />
            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td align="right" style="width: 150px;">@Html.LabelFor(x => x.City):
            </td>
            <td>
                @Html.DropDownListFor(x => x.City, Model.GetCitySelectListItems(), "请选择......", new { style = "width:165px;" })
            </td>
            <td align="right">@Html.LabelFor(x => x.ConstructPost):
            </td>
            <td>
                @Html.TextBoxFor(x => x.ConstructPost, new { style = "width:165px;" })<br />
            </td>
            <td align="right">@Html.LabelFor(x => x.ConstructOtherWay):
            </td>
            <td>
                @Html.TextBoxFor(x => x.ConstructOtherWay, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.ConstructOtherWay)
            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr>
            <td align="right" style="width: 150px;vertical-align: top;">
                @Html.LabelFor(x => x.ConstructDesc):
            </td>
            <td colspan="7">
                @Html.TextAreaFor(x => x.ConstructDesc, new { style="width: 970px; min-height:64px; line-height:16px;" })<br />
                @Html.ValidationMessageFor(x => x.ConstructDesc)
            </td>
        </tr>
        <tr>
            <td align="right" style="width: 150px;">
                文件/图片上传:
            </td>
            <td colspan="7">
                @Html.HiddenFor(m => m.TravelFileId)
                @Html.HiddenFor(m => m.ID)
                @(Html.Telerik().Upload()
                                .Name("attachments")
        .Multiple((bool)ViewData["multiple"])
        .Async(async => async
                                                    .Save("SaveConstructFile", "Construct", new { strImageName = Model.TravelFileId })
                                                    .Remove("RemoveConstructFile", "Construct")
            .AutoUpload((bool)ViewData["autoUpload"])
        )
                        .ClientEvents(events => events.OnUpload("UploadProfileImage_OnUpload").OnComplete("OnComplete"))
)
            </td>
        </tr>
        <tr>
            <td style="width: 150px; text-align:right">
                <label>
                    文件/图片下载:</label>
            </td>
            <td colspan="7">
                <div id="filelist">
                    <ul id="filelist_file">
                    </ul>
                    <ul id="filelist_img">
                    </ul>
                </div>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
    </table>
    <table class="noline" style="border:1px solid #eee;">
        <tr style="line-height: 1px; background:#f1f1f1;">
            <td colspan="8">
                <p style="font-weight: bolder">
                    投影机</p>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr>
            <td align="right">@Html.LabelFor(x => x.ProjectorThreePrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("ProjectorThreePrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" }))
                @Html.ValidationMessageFor(x => x.ProjectorThreePrice)
            </td>
            <td align="right">@Html.LabelFor(x => x.ProjectoFivePrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("ProjectoFivePrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" }))
                @Html.ValidationMessageFor(x => x.ProjectoFivePrice)
            </td>
            <td colspan="4">&nbsp;</td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr style="line-height: 1px; background:#f1f1f1">
            <td colspan="8">
                <p style="font-weight: bolder">
                    幕布</p>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr>
            <td align="right">@Html.LabelFor(x => x.ScreenZeroPrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("ScreenZeroPrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" }))
                @Html.ValidationMessageFor(x => x.ScreenZeroPrice)
            </td>
            <td align="right">@Html.LabelFor(x => x.ScreenTwoPrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("ScreenTwoPrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" }))
                @Html.ValidationMessageFor(x => x.ScreenTwoPrice)
            </td>
            <td align="right">@Html.LabelFor(x => x.ScreenFivePrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("ScreenFivePrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" }))
                @Html.ValidationMessageFor(x => x.ScreenFivePrice)
            </td>
            <td colspan="2">&nbsp;</td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr style="line-height: 1px; background:#f1f1f1">
            <td colspan="8">
                <p style="font-weight: bolder">
                    音响设备</p>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr>
            <td align="right">@Html.LabelFor(x => x.SoundConsole):
            </td>
            <td>
                @Html.TextBoxFor(x => x.SoundConsole, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.SoundConsole)
            </td>
            <td align="right">@Html.LabelFor(x => x.SoundPlatform):
            </td>
            <td>
                @Html.TextBoxFor(x => x.SoundPlatform, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.SoundPlatform)
            </td>
            <td align="right">@Html.LabelFor(x => x.SoundSic):
            </td>
            <td>
                @Html.TextBoxFor(x => x.SoundSic, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.SoundSic)
            </td>
            <td align="right">@Html.LabelFor(x => x.SoundApis):
            </td>
            <td>
                @Html.TextBoxFor(x => x.SoundApis, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.SoundApis)
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr style="line-height: 1px; background:#f1f1f1;">
            <td colspan="8">
                <p style="font-weight: bolder">
                    设计制作全套VI</p>
            </td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
        <tr>
            <td align="right">@Html.LabelFor(x => x.VIBackPlat):
            </td>
            <td>
                @Html.DropDownListFor(x => x.VIBackPlat, new[] { new SelectListItem() { Text = "写真每平", Value = "1" }, new SelectListItem() { Text = "喷绘每平", Value = "2" } }, "请选择......", new { style = "width:165px;" })<br />
            </td>
            <td align="right">@Html.LabelFor(x => x.VIBackPlatPrice):
            </td>
            <td>
                @(Html.Telerik().CurrencyTextBox().Name("VIBackPlatPrice").Value(0).InputHtmlAttributes(new { style = "width: 165px" })
      )
                @Html.ValidationMessageFor(x => x.ScreenFivePrice)<br />
            </td>
            <td align="right">@Html.LabelFor(x => x.VIXback):
            </td>
            <td>
                @Html.TextBoxFor(x => x.VIXback, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.VIXback)
            </td>
            <td align="right">@Html.LabelFor(x => x.VIRollUp):
            </td>
            <td>
                @Html.TextBoxFor(x => x.VIRollUp, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.VIRollUp)
            </td>
        </tr>
        <tr>
            <td align="right">@Html.LabelFor(x => x.VIKT):
            </td>
            <td>
                @Html.TextBoxFor(x => x.VIKT, new { style = "width:165px;" })<br />
                @Html.ValidationMessageFor(x => x.VIKT)
            </td>
            <td colspan="6">&nbsp;</td>
        </tr>
        <tr><td colspan="8" style="height:10px;"></td></tr>
    </table>
    @Html.Telerik().Window().Name("showImage").Title("显示图片").Content(
@<text>
    <div id="ImgField">
    </div>
    </text>
    ).Visible(false).Resizable().Width(600).Height(480)
</fieldset>
<script type="text/javascript">
    var count = 0;
    function getFile() {
        var id = $("#ID").val();
        var url = "/Construct/GetFile/";
        $.post(url, { 'ID': id }, function (data) {
            $.each(data, function (i, item) {
                var result = /\.[^\.]+/.exec(item.FileName);
                if (result != ".jpg" && result != ".png" && result && ".jpeg" && result != ".gif") {
                    $("#filelist_file").append(
                    '<li id=tf-' + item.ID + '>' +
                    '<a href=' + item.FileUrl + ' target="_blank">' + item.FileName + '</a>' +
                    '<a href="javascript:;" onclick="deletetaskfile(' + item.ID + ')">删除</a>' +
                    '</li>');
                }
                else {
                    $("#filelist_img").append(
                    '<li id=tf-' + item.ID + '>' +
                    '<img width="100px" height="60px" id=' + item.ID + ' src="' + item.FileUrl + '" onclick ="showImageWindow(' + item.ID + ')"/>' +
                    '<a href=' + item.FileUrl + ' target="_blank">' + item.FileName + '</a>' +
                    '<a href="javascript:;" onclick="deletetaskfile(' + item.ID + ')">删除</a>' +
                    '</li>');
                }
            });

        });
    }

    (function () {

        if ((document.readyState && document.readyState == 'complete' && $("#ID").val() != "0") || count == 5) {
            var id = $("#ID").val();
            getFile();
        } else {
            count++;
            setTimeout(arguments.callee, 10);
        }
    })();

    function deletetaskfile(id) {
        var name = $("#tf-" + id).find("a").eq(0).text();
        if (confirm("确定将" + name + "删除吗")) {
            $.ajax({
                url: "/Construct/deletefile/" + id,
                type: "post",
                dataType: "json",
                success: function (data, status) {

                    if (data == "OK") {
                        $("#tf-" + id).remove();
                    }
                }
            });
        }
    }

    function showImageWindow(e) {
        $("#ImgField").empty();
        var url = $("#" + e).attr("src");
        var window = $("#showImage").data("tWindow");
        $("#ImgField").append("<img  alt='' id=" + e + " src=" + url + " />");
        window.center().open();
    }
   

  
</script>
<style>
    .t-upload
    {
        float: left;
    }
    
    .note
    {
        clear: left;
        float: left;
    }
    .noline
    {
        width: 1250px;
    }
    .noline, .noline tr, .noline td
    {
        border: 0;
        padding: 2px;
    }
    .tableTd
    {
        width: 120px;
        float: left;
        text-align: left;
    }
    #filelist_file
    {
        clear: both;
        display: inline-block;
        width: 1071px;
    }
    #filelist_img
    {
        clear: both;
        display: inline-block;
        padding-top: 15px;
        margin-top: 5px;
        width: 1071px;
        border-top: 1px dotted #eee;
    }
    #filelist_file li
    {
        width: 357px;
        height: 28px;
        float: left;
    }
    #filelist_img li
    {
        width: 357px;
        float: left;
    }
</style>
